package com.storeapp.util;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.FileSystemXmlApplicationContext;

public class SpringUtils {
	private static ApplicationContext ctx = null;
	public SpringUtils() {
		SpringUtils.ctx = new FileSystemXmlApplicationContext("/"+ProjectUtil.toFullPath("resources/applicationContext.xml"));
	}
	
	public static ApplicationContext getApplicationContext() {
		if( SpringUtils.ctx == null ) {
			return new FileSystemXmlApplicationContext("/"+ProjectUtil.toFullPath("resources/applicationContext.xml"));
		} else {
			return SpringUtils.ctx;
		}
	}
}
